<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<%@page import="java.util.List"%>
<%@page import="com.boc.image.web.UserTask"%>
<%@page import="java.util.Map"%>
<%@page import="com.boc.news.beans.DateUtil"%>
<%@page import="java.util.Date"%>
<%@page import="java.util.HashMap"%>
<jsp:useBean id="userTask" class="com.boc.image.web.UserTask"/>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link type="text/css" href="../../css/base.css" rel="stylesheet"/>
<script type="text/javascript" src="../../js/public.js"></script>
<script type="text/javascript" src="script/history.js"></script>
</head>
<body>
<div class="frame_01">
	<div class="frame_01_left">用户任务历史</div>
	<div class="frame_01_right">
		<a href="/index.html" target="_top">首页</a>&nbsp;》
		<a href="/core" target="_top">管理中心</a>&nbsp;》
		<font color="#000">用户任务历史</font>
	</div>
</div>
<div class="frame_02"></div>
<div class="frame_03" style="overflow:hidden;">
<table width="755" border="0" cellspacing="0">
	  <tr>
		<td align="center" valign="top">
			<table width="700" border="0" cellspacing="0">
			  <tr>
				<td height="25" width="200" style="border-bottom:3px solid #FF0000;color:#FF0000;" align="left">
					【我的历史任务】
				</td>
				<td width="500" style="border-bottom:3px solid #FF0000;color:#FF0000;" align="right">
					【<a href="/filter/task/history?cType=0&currPage=1">全部任务</a>】【<a href="/filter/task/history?cType=1&currPage=1">已完成的任务</a>】【<a href="/filter/task/history?cType=2&currPage=1">未完成的任务</a>】
				</td>
			  </tr>
			  <tr>
				<td colspan="2" valign="top" height="35">
					<table width="700" border="0" cellspacing="5" height="35" style="font-weight:bold;">
					  <tr>
						<td align="center" style="border-bottom:1px solid #808080; ">任务名称</td>
						<td align="center" width="90" style="border-bottom:1px solid #808080; ">接收时间</td>
						<td align="center" width="60" style="border-bottom:1px solid #808080; ">状态</td>
						<td align="center" width="90" style="border-bottom:1px solid #808080; ">提交时间</td>
						<td align="center" width="90" style="border-bottom:1px solid #808080; ">结束时间</td>
						<td align="center" width="70" style="border-bottom:1px solid #808080; ">所得积分</td>
						<td align="center" width="80" style="border-bottom:1px solid #808080; ">提交任务</td>
					  </tr>
				  </table>
				</td>
			  </tr>
			  <tr>
			  	<td colspan="2" valign="top">
					<table width="700" border="0" cellspacing="5" style="color:blue">
					<%
					  	Object cType = request.getParameter("cType");
					  	int currPage = Integer.parseInt(request.getParameter("currPage").toLowerCase());
					  	Object userId = request.getSession().getAttribute("userId");
					  	Map params = new HashMap();
					  	params.put("nUserid",userId);
					  	params.put("cType",cType);
					  	Map pages = userTask.geSumPages(params);
					  	int totalRows = Integer.parseInt(pages.get("totalRows").toString());
						int totalPages = Integer.parseInt(pages.get("totalPages").toString());
						int pageRows = Integer.parseInt(pages.get("pageRows").toString());
					  	
					  	params.put("currPage",currPage);
						params.put("pageRows",pageRows);
						
						List result = userTask.getPageContent(params);
						int size = result.size();
						String strZt[] = new String[]{"","未提交","审核中","<font color=red>审核失败</font>","<font color=green>审核通过</font>"};
						for (int i = 0 ; i < size ; i ++) {
							Map bean = (Map) result.get(i);
							String cZt = bean.get("cZt").toString();
							String zt = strZt[Integer.parseInt(cZt)];
							%>
							  <tr>
								<td align="left" style="border-bottom:1px dashed #808080" height="20">
										<label style="color:#FF0000; font-weight:bold" onMouseOver="this.style.cursor='pointer';" onMouseDown="mouseClose(<%=i%>,this)" >＋</label>&nbsp;<%=bean.get("cTitle") %>
								</td>
								<td align="center" width="90" style="border-bottom:1px dashed #808080">
									<%=DateUtil.datetimeToString((Date)bean.get("dKssj"),"yyyy-MM-dd") %>
								</td>
								<td align="center" width="60" style="border-bottom:1px dashed #808080">
									<%=zt%>
								</td>
								<td align="center" width="90" style="border-bottom:1px dashed #808080">
									<%=bean.get("dTjsj")==null?"":DateUtil.datetimeToString((Date)bean.get("dTjsj"),"yyyy-MM-dd") %>
								</td>
								<td align="center" width="90" style="border-bottom:1px dashed #808080">
									<%=bean.get("dJssj")==null?"":DateUtil.datetimeToString((Date)bean.get("dJssj"),"yyyy-MM-dd") %>
								</td>
								<td align="center" width="70" style="border-bottom:1px dashed #808080">
									<%=bean.get("nSdjf")==null?"":bean.get("nSdjf") %>
								</td>
								<td align="center" width="80" style="border-bottom:1px dashed #808080">
									<%if(cZt.equals("1")) { %>
										<a href="<%=bean.get("cUrl") %>?nId=<%=bean.get("nId") %>&nRwbh=<%=bean.get("nRwbh") %>" style="color:red">提交该任务</a>
									<%}else{ %>
										<font color="#cccccc">提交该任务</font>
									<%} %>
								</td>
							  </tr>
							  <tr>
							  	<td align="left" id="display_<%=i%>" style="background-color:#ffffe1; border:1px solid #dce3ed; padding:10px 5px 10px 10px; display:none; color:#cccccc;" colspan="7" valign="top">
								<% if(bean.get("nRwbh").toString().equals("1") && (cZt.equals("3") || cZt.equals("4"))) { 
									Map userTzTask = userTask.getUserTzInfo(bean.get("nId"));								%>
									<table width="600" border="0" cellspacing="0">
									  <tr>
										<td width="80" height="20" align="right">帖子ID：</td>
										<td width="100" align="center"><%= userTzTask.get("cUsername")%></td>
										<td width="100" align="right">帖子地址：</td>
										<td align="left"><a href="<%= userTzTask.get("cAddress")%>" target="_blank"><%= userTzTask.get("cAddress")%></a></td>
									  </tr>
									  <tr>
										<td width="80" align="right" style="line-height:20px;">帖子描述：</td>
										<td colspan="3" align="left" style="line-height:20px;">
											<%= userTzTask.get("cMs")%>
										</td>
									  </tr>
									  <tr>
										<td width="80" align="right" style="line-height:20px;">审核备注：</td>
										<td colspan="3" align="left" style="line-height:20px;">&nbsp;</td>
									  </tr>
									</table>
								<%} else { %>
									占无信息<%=bean.get("nRwbh").toString() %>
								<%} %>
								</td>
							  </tr>
							<%
						}
					  %>
					  </table>
				</td>
			  </tr>
			</table>
		</td>
	</tr>
</table>

</div>
<div class="frame_03" style="height:50px; line-height:50px; text-align:center; vertical-align:middle;">
	<%
			
			out.print("共"+totalPages+"页&nbsp;&nbsp;&nbsp;");
			out.print("<font color=red><b>"+currPage+"</b></font>/"+totalPages+"页&nbsp;&nbsp;&nbsp;");
			if(currPage == 1) {
				out.print("<font color='#cccccc'>首页&nbsp;&nbsp;&nbsp;上一页</font>");
			} else {
				out.print("<a href='/filter/task/history?cType="+cType+"&currPage=1'>首页</a>&nbsp;&nbsp;&nbsp;");
				out.print("<a href='/filter/task/history?cType="+cType+"&currPage="+(currPage-1)+"'>上一页</a>");
			}
			if(currPage == totalPages) {
				out.print("<font color='#cccccc'>&nbsp;&nbsp;&nbsp;下一页&nbsp;&nbsp;&nbsp;尾页</font>");
			} else {
				out.print("&nbsp;&nbsp;&nbsp;<a href='/filter/task/history?cType="+cType+"&currPage="+(currPage+1)+"'>下一页</a>");
				out.print("&nbsp;&nbsp;&nbsp;<a href='/filter/task/history?cType="+cType+"&currPage="+totalPages+"'>尾页</a>");
			}
		%>
		<select onChange="location.href='/filter/task/history?cType=<%=cType %>&currPage='+this.value">
			<%
			for(int i = 0; i < totalPages;i++){
				if(currPage == i+1){
			%>
			<option value="<%=(i+1) %>" selected="selected">第<%=(i+1)%>页</option>
			<%
				}else{
			 %>
			 <option value="<%=(i+1) %>">第<%=(i+1)%>页</option>
			 <%}} %>
		</select>
</div>
<div class="frame_04"></div>

</body>
</html>